fix: 7 correctness bugs from adversarial review of this session's code (deja floor, harden worktree, ledger-sync, cortex metric, verify base, radar usage, precommit parse)#70
Merged
CodeWithJuber merged 1 commit intoJul 17, 2026
Conversation
…19–v0.21 code An adversarial review (13 reviewers → per-finding refutation) of everything shipped this session confirmed 7 real, reachable bugs and rejected the rest. Fixes: - deja: DEJA_FLOOR 0.55 → 0.39 — the old floor exceeded the ~0.42 score() ceiling for a repo-scoped summary, so the déjà-vu advisory could NEVER fire (HIGH; core feature was a silent no-op). Adds an end-to-end recordSessionSummary→dejaAdvisory regression test. - harden: resolve the git hooks dir via `git rev-parse --git-path hooks` — .git is a FILE in a linked worktree/submodule, so the hardcoded .git/hooks threw ENOTDIR (MEDIUM). - ledger_sync: only trust the up-to-date short-circuit when the fetch found the ref on THIS remote — a shared ref name left over from another remote could skip the push (MEDIUM). - cortex_hook_main: preflight halt metric read a non-existent result.gate?.halted → always "pass"; now reads assumption.shouldAsk (MEDIUM). - verify: changedFiles now mirrors added's --cached fallback so the structural lenses don't go silent on a mismatched evidence base (LOW). - radar: match dep names most-specific-first so lodash.debounce isn't swallowed by lodash's member prefix (LOW). - commit_gate: track hunk state so an added line beginning with `++ ` isn't misread as a `+++ ` diff header (LOW). Full suite 887 pass / 0 fail / 2 skip; biome/tsc/docs check green. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_017Ebv4QDTqzPzgApBW2KUsU
CodeWithJuber
marked this pull request as ready for review
July 17, 2026 17:09
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What & why
An adversarial audit (13 module reviewers → per-finding refutation by an independent skeptic) of everything shipped this session (v0.19→v0.21) confirmed 7 real, reachable bugs and rejected the rest. This PR fixes all seven, each with a verified failure scenario. One is a high-severity silent feature failure.
src/deja.jsDEJA_FLOOR(0.55) exceeded the ~0.42 maxretrieve()can score for a repo-scopedsummary(σ term < 0.73 × 0.6 scope-weight), so the déjà-vu advisory could never fire — the whole anti-repetition feature was a silent no-op. Recalibrated to 0.39 (band: unrelated ≈0.34, identical ≈0.42) + an end-to-end regression test (recordSessionSummary→dejaAdvisory) so it can't drift out of range again.src/harden.js.gitis a file, somkdirSync('.git/hooks')threwENOTDIRand abortedforge harden. Hooks dir now resolved viagit rev-parse --git-path hooks.src/ledger_sync.jsrefs/<cli>/ledgerfrom a prior remote, so a new/pruned remote was reportedupToDatewithout ever being pushed to. Now only trusts it when the fetch actually found the ref on this remote.src/cortex_hook_main.jsresult.gate?.halted— a fieldsubstrateCheck()never returns — so the cost dashboard's halt-rate was permanently zero. Now readsassumption.shouldAsk.src/verify.jsaddedfell back to--cachedbutchangedFilesdidn't, soverify --deep's structural lenses went silent on a base whose worktree matches HEAD while the index differs.changedFilesnow mirrors the fallback.src/radar.jslodashcould steallodash.debounce's import count via a first-match break in alphabetical order. Names are now matched most-specific-first.src/commit_gate.js++rendered as+++and was misread as a diff header. The parser now tracks hunk state so headers only match before@@.Checklist
npm testpasses — 887 pass / 0 fail / 2 skipnpm run checkpasses (Biome — 6 pre-existing warnings, 0 errors)CHANGELOG.mdupdated under## [Unreleased](### Fixed, 7 bullets)docs checkgreenRisk & rollback
Extra checks (tick if applicable)
npm run typecheckpasses🤖 Generated with Claude Code
https://claude.ai/code/session_017Ebv4QDTqzPzgApBW2KUsU
Generated by Claude Code